using System.Web.UI;

namespace OpenWaves.Web.Controls
{
    public class TreeNodeContainer<T> : Control, ITreeNodeContainer
    {
        public object DataItem
        {
            get { return this.Node; }
        }

        public int DataItemIndex
        {
            get { return this.NodeIndex; }
        }

        public int DisplayIndex
        {
            get { return this.NodeIndex; }
        }

        private readonly T node;
        public T Node
        {
            get { return this.node; }
        }

        private readonly int nodeIndex;
        public int NodeIndex
        {
            get { return this.nodeIndex; }
        }

        private readonly int nodeLevel;
        public int NodeLevel
        {
            get { return this.nodeLevel; }
        }

        private readonly bool nodeHasVisibleChildren;
        public bool NodeHasVisibleChildren
        {
            get { return this.nodeHasVisibleChildren; }
        }

        public TreeNodeContainer(T node, int nodeIndex, int nodeLevel, bool nodeHasVisibleChildren)
        {
            this.node = node;
            this.nodeLevel = nodeLevel;
            this.nodeIndex = nodeIndex;
            this.nodeHasVisibleChildren = nodeHasVisibleChildren;
        }
    }
}